<!DOCTYPE html>
<html >
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>同期发情</title>
	<link href="../css/home.page.css" rel="stylesheet" />
    <link href="../css/mui.min.css" rel="stylesheet" type="text/css">
    <link href="../bootstrap-select/bootstrap-select.css" rel="stylesheet">
    <link href="../css/bootstrap.min.css" rel="stylesheet" >
	<link href="../css/mui.picker.min.css" rel="stylesheet" >
    <script charset="UTF-8" src="../js/jquery.min.js"></script>
    <script charset="UTF-8" src="../js/config.js"></script>
    <script charset="UTF-8" src="../js/core.js"></script>
    <script charset="UTF-8" src="../js/cipher-core.js"></script>
    <script charset="UTF-8" src="../js/tripledes.js"></script>
    <script charset="UTF-8" src="../js/mode-ecb.js"></script>
    <script charset="UTF-8" src="../js/zepto.min.js"></script>
    <script charset="UTF-8" src="../js/spin.min.js"></script>
    <script charset="UTF-8" src="../js/mui.min.js"></script>
    <script charset="UTF-8" src="../js/testActivityName.js"></script>
    <script charset="UTF-8" src="../js/simple.tool.js"></script>
	<script charset="UTF-8" src="../js/mui.picker.min.js"></script>
    <style>
        label{
            text-align: right;
        }
        .btn-default{
            border-color: snow;
        }
        .form-control{
            -webkit-box-shadow: inset 0 0px 0px rgba(0,0,0,.075);
        }
        .form-group{
            border-bottom: 1px solid #f6f6f6;max-width: 720px;height: 55px;
        }
    </style>
</head>
<body class="white-bg" onload="myfunction()">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" style="width: 95%;" id="form-synestrus-add" target="ifr">
        <div class="form-group" style="margin-bottom: 0px;border-bottom: 0px solid #f6f6f6;">
            <div class="head-jnx" onclick="record()">
                <img src="../img/fanhui@3x.png" />
                <p>同期发情</p>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">耳号：<span style="color: red">*</span></label>
            <div class="col-xs-7">
                <select name="cowId" class="selectpicker form-control m-b" data-live-search="true" title="选择耳号"  data-size="10" id="overbit" required>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">同期时间：<span style="color: red">*</span></label>
            <div class="col-xs-7">
                <div class="input-group date">
                    <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                    <input id="syndate" type="text" onclick="dtPicker('syndate')"  onfocus=this.blur()>
                </div>
            </div>
        </div>
        <div class="form-group" style="display: none">
            <label class="col-xs-4 control-label">同期方案编号：<span style="color: red">*</span></label>
            <div class="col-xs-7">
                <input name="contemporaneousSchemeId" class="form-control" type="text" id="contemporaneousSchemeId">
            </div>
        </div>
		<div class="form-group">
			<label class="col-xs-4 control-label">同期方案名称：<span style="color: red">*</span></label>
			<div class="col-xs-7">
				<select name="contemporaneousSchemeName"  id="contemporaneousSchemeName" style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" onchange="getOperation()" required>

				</select>
			</div>
		</div>
        <div class="form-group">
            <label class="col-xs-4 control-label">操作：<span style="color: red">*</span></label>
            <div class="col-xs-7">
                <select onclick="inspectNumber()" name="operation" id="operation" style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" onchange="getSequence()" required>
					<option value=''>请选择</option>
				</select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">流程顺序：<span style="color: red">*</span></label>
            <div class="col-xs-7">
                <input name="processSequence" class="form-control" type="text" id="processSequence" readonly required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">是否有效操作：</label>
            <div class="col-xs-7">
                <div class="radio-box">
                    <input type="radio" name="effectiveOperation" value="1" checked>
                    <label>是</label>
                    <input type="radio" name="effectiveOperation" value="2">
                    <label>否</label>
                </div>
            </div>
        </div>
		 <div class="form-group">
            <label class="col-xs-4 control-label">执行人：</label>
            <div class="col-xs-7">
                <select name="patronn" id="patronn" style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" required>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">激素编号：</label>
            <div class="col-xs-7">
                <input name="hormoneNumber" class="form-control" type="text" placeholder="请输入">
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">激素名称：</label>
            <div class="col-xs-7">
                <input name="hormoneName" class="form-control" type="text" placeholder="请输入" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">生产批号：</label>
            <div class="col-xs-7">
                <input name="productionNumber" class="form-control" type="text" placeholder="请输入">
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">规格：</label>
            <div class="col-xs-7">
                <input name="specifications" class="form-control" type="text" placeholder="请输入" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">单位：</label>
            <div class="col-xs-7">
                <input name="unit" class="form-control" type="text" placeholder="请输入" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">用量：</label>
            <div class="col-xs-7">
                <input name="consumption" class="form-control" type="text" placeholder="请输入">
            </div>
        </div>
        <!--<div class="form-group">-->
        <!--<label class="col-xs-4 control-label">组别名称：</label>-->
        <!--<div class="col-xs-7">-->
        <!--<input name="groupName" class="form-control" type="text">-->
        <!--</div>-->
        <!--</div>-->
        <!--<div class="form-group">-->
        <!--<label class="col-xs-4 control-label">组别类型：</label>-->
        <!--<div class="col-xs-7">-->
        <!--<select name="groupType" class="form-control m-b">-->
        <!--<option value="">所有</option>-->
        <!--</select>-->
        <!--&lt;!&ndash;<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>&ndash;&gt;-->
        <!--</div>-->
        <!--</div>-->
        <!--<div class="form-group">    -->
        <!--<label class="col-xs-4 control-label">泌乳状态：</label>-->
        <!--<div class="col-xs-7">-->
        <!--<div class="radio-box">-->
        <!--<input type="radio" name="lactationStatus" value="">-->
        <!--<label th:for="lactationStatus" th:text="未知"></label>-->
        <!--</div>-->
        <!--<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
        <!--</div>-->
        <!--</div>-->
        <div class="form-group">
            <label class="col-xs-4 control-label">备注：</label>
            <div class="col-xs-7">
                <input name="remake" class="form-control" type="text" placeholder="请输入" >
            </div>
        </div>
        <div class="form-group">
            <div style="width: 320px; margin: auto;">
                <div class="quxiao-btn" style="margin-right: 15px;" onclick="record()">取消</div>
                <input type="submit" value="保存信息" class="quxiao-btn" style="background: #0078fb; color: #FFFFFF;border-radius: 55px;" >
                <div class="clear"></div>
            </div>
		</div>
    </form>
</div>
<iframe name='ifr' id="ifr" style='display: none;'></iframe><!--表单提交防止刷新-->
<script src="../js/bootstrap.min.js"></script>
<script src="../bootstrap-select/bootstrap-select.js"></script>
<script type="text/javascript">
	var mapS={}
	mapS.url="getsynestrusdata";
	var overbitList=ajaxRequestPostS(mapS);
    window.onload=breedLoad();
	function myfunction(){
		
	}
		var i = setTimeout(function(){
			overbitList = JSON.parse(localStorage.getItem('getsynestrusdata'));
			console.log(overbitList)
		    if(overbitList != 0){
				
				loadSelect('overbit',overbitList,'cow_id','overbit');//耳号
				$('.selectpicker').selectpicker('refresh');
				
			}
		},900);
		
	
	
	(function (doc, win) {
	console.log(1111)
	  var docEl = doc.documentElement,
		resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		recalc = function () {
		  var clientWidth = docEl.clientWidth;
		  if (!clientWidth) return;
		  docEl.style.fontSize = 100 * (clientWidth / 320) + 'px';
		};
	 
	  // Abort if browser does not support addEventListener
	  if (!doc.addEventListener) return;
	  win.addEventListener(resizeEvt, recalc, false);
	  doc.addEventListener('DOMContentLoaded', recalc, false);
	})(document, window);
	
    function breedLoad() {//获得下拉数据
		var resultData = JSON.parse(localStorage.getItem('addsynestrusdata'));
        breedHtml(resultData.data);
		
        $("#syndate").val(getDateNow());
    }
    $("#form-synestrus-add").submit(function () {
		map={};
        map=$('#form-synestrus-add').serializeObject();
        map.url="addsynestrus";
        map.overbit=$("#overbit option:selected").text();
        var resultData=ajaxRequestPostSubmit(map);
        if (resultData.head.info == "增加成功") {
            setTimeout(function () {
                record();
            }, 1000);
        }
    });
    function record() {//返回记录
        window.location = "../记录.html";
    }
    function breedHtml(resultData) {//加载下拉
        
        var contemporaneousSchemeName=resultData.contemporaneousSchemeName;
        loadSelect('contemporaneousSchemeName',contemporaneousSchemeName,'schemeId','schemeName');//同期方案名称
		var breederList = resultData.breederList;
		var userName = resultData.realName;
        loadSelect('patronn',breederList,'real_name','real_name',userName);//执行人
        $('.selectpicker').selectpicker('refresh');
    }
    function loadSelect(id,data,code,name,userName) {
        $("#"+id).html("");
        $("#"+id).append("<option value=''>请选择</option>");
        for (i=0;i<data.length;i++){//
			var str='';
			if(userName != null && data[i][name] == userName){
				str='<option value="'+data[i][code]+'" selected>'+data[i][name]+'</option>';
			}else{
				str='<option value="'+data[i][code]+'">'+data[i][name]+'</option>';
			}
            $("#"+id).append(str);
        }
    }
    function getOperation() {
        var contemporaneousSchemeName = $("#contemporaneousSchemeName").val();
        $("#contemporaneousSchemeId").val(contemporaneousSchemeName);
        var map={};
        map.url='getoperation';
        map.schemeId=contemporaneousSchemeName;
        var resultData=ajaxRequestPost(map);
        var operation=resultData.data.operation;
        loadSelect('operation',operation,'processSequence','operation');
        $('.selectpicker').selectpicker('refresh');
    }

    function getSequence() {
        var sequence = $("#operation").val();
        $("#processSequence").val(sequence);
    }
	function inspectNumber(){
		var reasonSort = $("#contemporaneousSchemeName").val();
		var diseaseDetails = $("#operation").val();
		if((diseaseDetails == null || diseaseDetails == "") && (reasonSort == null || reasonSort == "")){
			mui.toast("请先选择[同期方案名称]");
		}
	}
	 
</script>
</body>
</html>